#include "widget.h"
#include "ui_widget.h"
#include <QPainter>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::paintEvent(QPaintEvent *event)
{
    (void)event;
    QPainter painter(this);
    // 定义画笔
    QPen pen;
    // 设置画笔颜色
    pen.setColor(Qt::red);
    // 设置线条的风格
    pen.setStyle(Qt::DashLine);
    // 设置线条的粗细
    pen.setWidth(5);
    // 让 painter 应用 pen 画笔
    painter.setPen(pen);

    // 绘制一个圆
    painter.drawEllipse(100,100,100,100);
}

